<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateFormInstanceBizRelationTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('form_instance_biz_relation', function (Blueprint $table) {
            $table->bigInteger('id', true);
            $table->string('type', 45)->nullable();
            $table->string('form_key', 45)->nullable()->index('fk_idx');
            $table->bigInteger('form_instance_id')->nullable()->index('form_instance_id_idx');
            $table->bigInteger('biz_id')->nullable()->index('biz_id_idx')->comment('业务表数据id');
            $table->bigInteger('user_id')->nullable()->index('user_id_idx');
            $table->string('comment', 45)->nullable();
            $table->bigInteger('data_version_id')->nullable()->index('dvid_idx');
            $table->string('data_version_name', 45)->nullable();
            $table->integer('minor_version')->nullable()->comment('1/2/3/4/5  填写5次');
            $table->integer('deleted')->nullable()->default(0);
            $table->dateTime('create_time', 6)->nullable();
            $table->bigInteger('creator_id')->nullable();
            $table->dateTime('update_time', 6)->nullable();
            $table->bigInteger('updater_id')->nullable();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('form_instance_biz_relation');
    }
};
